package net.sourceforge.peertwitter.scamp.timers;


import net.sourceforge.peertwitter.scamp.SCAMP_MGRD;
import rice.p2p.commonapi.Id;
import rice.selector.TimerTask;


public class CheckHeartbeatAck extends TimerTask {
	
	private final SCAMP_MGRD scamp_MGRD;
	private final Id group;

	public CheckHeartbeatAck(SCAMP_MGRD scamp_MGRD, Id group) {
		this.scamp_MGRD = scamp_MGRD;
		this.group = group;
	}

	@Override
	public void run() {
		scamp_MGRD.disableSwarm(group);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((group == null) ? 0 : group.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		CheckHeartbeatAck other = (CheckHeartbeatAck) obj;
		if (group == null) {
			if (other.group != null) {
				return false;
			}
		} else if (!group.equals(other.group)) {
			return false;
		}
		return true;
	}
	
	
}